instantiate

open fun instantiate(@NonNull classLoader: ClassLoader, @NonNull className: String): Fragment(source)

Create a new instance of a Fragment with the given class name. This uses loadFragmentClass and the empty constructor of the resulting Class by default.

Return

Returns a new fragment instance.

Parameters

classLoader

The default classloader to use for instantiation

className

The class name of the fragment to instantiate.

Throws

If there is a failure in instantiating the given fragment class. This is a runtime exception; it is not normally expected to happen.